//纯函数和非纯函数
//slice / splice

//纯函数
let arr1 = [1, 2, 3, 4, 5];
console.log(arr1.slice(0, 3));
console.log(arr1.slice(0, 3));
console.log(arr1.slice(0, 3));

//不纯函数，相同输入不同输出
console.log(arr1.splice(0, 3));
console.log(arr1.splice(0, 3));
console.log(arr1.splice(0, 3));

//自写纯函数
function getSum(n1, n2) {
  return n1 + n2;
}
